package com.github.wxiaoqi.security.common.msg;

import com.github.pagehelper.Page;

import java.util.List;

/**
 * <p>分页返回</p>
 * Created by huangjt on 2018-12-19.
 * company robustel
 */
public class PageResultResponse<T> extends BaseResponse {
    /**
     * 总数
     */
    private long total;
    /**
     * 数据
     */
    private List<T> data;
    /**
     * 当前页
     */
    private int pageNum;
    /**
     * 每页数量
     */
    private int pageSize;
    /**
     * 总页数
     */
    private int pages;

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public PageResultResponse(){}
    public PageResultResponse(List<T> data){
        super(200,"success",true);
        Page p = (Page)data;
        this.total = p.getTotal();
        this.pageNum = p.getPageNum();
        this.pageSize = p.getPageSize();
        this.pages = p.getPages();
        this.data = data;
    }
}
